Repository navigation
feat(agent-config): wire exec-broker gates via kit agent-config --broker-gate (Pillar 3 adoption) - #307
Merged
Conversation
…ker-gate (Pillar 3 adoption) First adoption step for the exec-broker: make the PreToolUse gates installable, not just hand-wireable. installBrokerGates(cwd) writes both gate-egress (matcher Bash) and gate-fs (matcher Write|Edit|NotebookEdit) into .claude/settings.json, idempotently (keyed per gate; adds only the missing one on a partial re-run), preserving other hooks/settings. Deliberately OPT-IN via 'kit agent-config --broker-gate' (not default, unlike the install/env gates): the broker is fail-closed, so a wired egress-gate with no verified [scope] denies ALL network — only wanted once the operator has declared + signed a scope/RoE (the help line points at kit profile sign). Claude Code only today (the settings schema we know); other agents follow when their gate surfaces are mapped, same as the install-gate matrix. 5 tests: both gates wired + idempotent, partial-wire completion (adds only the missing gate), skip when no Claude project. No public-surface change (flag on an existing verb). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
|
✅ Docker image built successfully
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
First adoption step for the exec-broker (Pillar 3, mechanism delivered in #303–#306): make the PreToolUse gates installable via
kit agent-config, not just hand-wireable.installBrokerGateswrites bothgate-egressandgate-fsinto.claude/settings.json.Type of Change
Related Issues
Changes Made
src/agent-config.ts—installBrokerGates(cwd): wires PreToolUsegate-egress(matcherBash) +gate-fs(matcherWrite|Edit|NotebookEdit) into.claude/settings.json, idempotently (keyed per gate; a partial re-run adds only the missing one), preserving other hooks/settings. Claude Code only today (the settings schema we know), same staged rollout as the install-gate matrix.src/commands/agent.ts—kit agent-config --broker-gateopt-in flag drives it, with a help line pointing atkit profile sign.src/agent-config.test.ts— 5 tests: both gates wired + idempotent, partial-wire completion, skip when no Claude project.Testing
Test Coverage
npm test) — full suite 2712 pass / 0 fail (2709 baseline + 3 net new describe-cases across the agent-config suite)Manual Testing
npx tsc --noEmit→ clean;npx eslint src→ 0 errors.npm run build && node scripts/test.mjs→ 2712 pass, 0 fail.contracts/public-surface.jsonregenerated → no diff (flag on an existing verb, not a new command).Breaking Changes
None / N/A — opt-in flag; default
kit agent-configbehavior is unchanged.Checklist
npm test)Performance Impact
Reviewer Notes
The opt-in decision is the important one: the install/env gates are default-on because a false-negative there is silent risk, but the broker gates are fail-closed — a wired
gate-egresswith no verified[scope]denies all network, which would break an agent that hasn't declared a scope yet. So wiring them must be a deliberate act (--broker-gate), taken afterkit profile sign, and the help text says so. This is the honest default: don't auto-arm an enforcement that denies everything until the operator has set up what it enforces against. Remaining Pillar 3 adoption:scopeNeedsdeclarations on individual MCP operations, and extending the gate wiring to the other agents in the matrix.🤖 Generated with Claude Code
https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
Generated by Claude Code